package com.it.controller;

import com.alibaba.fastjson.JSON;
import com.it.pojo.CComment;
import com.it.pojo.CPost;
import com.it.pojo.CReply;
import com.it.service.MytidingService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class MytidingController {
    @Resource
    MytidingService mytidingService;
    @RequestMapping(value = "/selectAllByUid/{uid}")
    public List<CPost> selectAllByUid(@PathVariable Integer uid){
   /*     List<CPost> cPosts = mytidingService.selectAllByUid(uid);
        String s = JSON.toJSONString(cPosts);*/
        return  mytidingService.selectAllByUid(uid);
    }
    @RequestMapping(value = "/selectByUid/{list}/{uid}")
    public List<CPost> selectByUid(@PathVariable List<CComment> list,@PathVariable Integer uid){
 /*       List<CPost> cPosts = mytidingService.selectByUid(list, uid);
        String s = JSON.toJSONString(cPosts);*/
        return mytidingService.selectByUid(list, uid);
    }
    @RequestMapping(value = "/selectAllbyInitiatorid/{initiatorid}")
    public List<CComment> selectAllbyInitiatorid(@PathVariable Integer initiatorid){
/*        List<CComment> cComments =mytidingService.selectAllbyInitiatorid(initiatorid);
        String s = JSON.toJSONString(cComments);*/
        return mytidingService.selectAllbyInitiatorid(initiatorid);
    }
    @RequestMapping(value = "/selectByPid/{list}/{pid}")
    public List<CComment> selectByPid(@PathVariable List<CReply> list,@PathVariable Integer pid){
  /*      List<CComment> cComments = mytidingService.selectByPid(list, pid);
        String s = JSON.toJSONString(cComments);*/
        return  mytidingService.selectByPid(list, pid);
    }
    @RequestMapping(value = "/selectAllByRepliedid{repliedid}")
    public List<CReply> selectAllByRepliedid(@PathVariable Integer repliedid){
/*        List<CReply> cReplies = mytidingService.selectAllByRepliedid(repliedid);
        String s = JSON.toJSONString(cReplies);*/
        return  mytidingService.selectAllByRepliedid(repliedid);
    }
}
